---
title: clsTaskContext
summary: API reference for clsTaskContext.
status: draft
owner: SAIF Documentation
last_reviewed: 2026-08-21
library: SAIF.Business.Tasks
reference_type: embedded
---

# clsTaskContext

`clsTaskContext` is a plain value holder for the six "context" columns on a task row (`CONTEXT_CATEGORY`, `CONTEXT_CODE`, `CONTEXT_DATE`, `CONTEXT_KEY`, `CONTEXT_NUM`, `CONTEXT_TEXT`), used to associate a task with an arbitrary business entity outside the claim/policy/imaging references already on `clsTask`. It is deep-copied whenever a task is duplicated (see [Copy a task to another user](../../operations/copy-task-to-another-user.md)).

## Purpose
- Hold the six context values as SAIF "smart" types so callers can attach a task to any keyed entity via category/code/date/numeric/text fields.
- Support deep-copy semantics (`Duplicate()`) that preserve empty/null state when a task is copied to another user.

## Context
- Namespace: `SAIF.Business.Tasks`
- Assembly/package: `SAIF.Business.Tasks` (embedded in the `LegalMaintenance` web deployment)

## Public members
| Member | Signature | Purpose |
| --- | --- | --- |
| `Key` | `Property Key As <type>` | Identifier value for the context association*. |
| `Category` | `Property Category As clsSmartString` | Context category classification value. |
| `Code` | `Property Code As clsSmartString` | Context code value. |
| `NumericValue` | `Property NumericValue As clsSmartDecimal` | Context numeric value. |
| `DateValue` | `Property DateValue As clsSmartDate` | Context date value. |
| `Duplicate` | `Function Duplicate() As clsTaskContext` | Produces a deep copy of this context, preserving empty/null state for each smart-typed field. |

## Behavioral notes
- The class is `<Serializable()>`, consistent with remoting/session persistence of BOF objects across the web tier*.
- Persisted via `clsTask`'s insert/update parameters (`:ContextDate`, `:ContextNum`, `:ContextCode`, `:ContextCategory`, `:ContextKey`, `:ContextText`) rather than persisting itself ([SQL-001](../../sql/SQL-001-insert-task.md), [SQL-013](../../sql/SQL-013-update-task.md)).
- A defect in `clsTask.StoreValues`/`RestoreValues` causes restored context text to always be empty after an edit/cancel cycle (key mismatch between `ContextText` and `ContextTextValue`)*.

## Constraints and usage notes
- Values are used both for persistence and for building the `CONTEXT_*` search predicates in `clsTaskCollection.Criteria`, where they are concatenated unbound into the SQL text*.

> **Note:** Statements marked with * were inferred from code structure, naming conventions, or
> contextual evidence where direct confirmation was not available in source artifacts. Statements
> marked with ** could not be confirmed; treat as unknown until verified.

## Related documentation
- [API index](../index.md)
- [clsTask](clsTask.md)
- [Operation: Copy a task to another user](../../operations/copy-task-to-another-user.md)

## Sources
- SAIF.Business.Tasks/clsTaskContext.vb
